Separate and print the numbers of a given string¶
re.split(“D+”, S)
Separate and print the numbers of a given string.
import re
S = "Ten 10, Twenty 20, Thirty 30"
result = re.split("\D+", S)
for element in result:
print(element)
Output:
10
20
30